# Django settings for EE_django project.

import os

ROOT_PATH = os.path.dirname(__file__)


if os.environ.get('APACHE_RUN_USER'):
  BASE_PATH = 'https://graphics.tudelft.nl/sl3021/'
else:
  BASE_PATH = 'http://localhost:8000/'

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    ('Ben Sedee', 'B.M.W.Sedee@student.tudelft.nl'),
)

MANAGERS = ADMINS

DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = os.path.join(ROOT_PATH, 'EE_django.db')
DATABASE_USER = ''             # Not used with sqlite3.
DATABASE_PASSWORD = ''         # Not used with sqlite3.
DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.

# cpbotha: to mitigate those nasty sqlite3 database is locked errors...
DATABASE_OPTIONS = {'timeout': 30}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
if os.environ.get('APACHE_RUN_USER'):
  MEDIA_ROOT = '/home/sl3021/sl3021_django/media/'
else:
  MEDIA_ROOT = '/home/media/'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
if os.environ.get('APACHE_RUN_USER'):
  MEDIA_URL = 'https://graphics.tudelft.nl/sl3021/media/'
else:
  MEDIA_URL = 'http://localhost:8000/media/'


# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
if os.environ.get('APACHE_RUN_USER'):
  ADMIN_MEDIA_PREFIX = '/var/www/media/'
else:
  ADMIN_MEDIA_PREFIX = '/home/admin_media/'


# Make this unique, and don't share it with anybody.
SECRET_KEY = '!i68msc=bm!%n!(py%6c)e(4%s59r51wp$dth-=w=nk6bmii^l'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.load_template_source',
    'django.template.loaders.app_directories.load_template_source',
#     'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
)

ROOT_URLCONF = 'EE_django.urls'

TEMPLATE_DIRS = (
    os.path.join(ROOT_PATH, 'templates')
)

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.admin',
    'EE_django.EE',
    'django_extensions',
)

DATADIR = 'data/'

AUTH_PROFILE_MODULE = 'EE.UserProfile'

